import Role from '../api/v1/role';
import RoleGroup from '../api/v1/roleGroup';
import User from '../api/v1/user';
import Upload from '../api/v1/upload';
import Backups from '../api/v1/backups';
import Install from '../api/v1/install';
const RoleGroups = new RoleGroup();
const Roles = new Role();
const Users = new User();
const Uploads = new Upload();
const Backupss = new Backups();
const Installs = new Install();
export default [
  // 安装系统
  { isAuth: false, type: 'post', path: 'install', event: (req?: any, res?: any) => Installs.install(req, res) },
  { isAuth: false, type: 'get', path: 'install/list', event: (req?: any, res?: any) => Installs.list(req, res) },

  // 上传文件
  { type: 'post', path: 'upload', event: (req?: any, res?: any) => Uploads.add(req, res) },

  // 用户
  { isAuth: false, type: 'get', path: 'logout', event: (req?: any, res?: any) => Users.logout(req, res) },
  { isAuth: false, type: 'post', path: 'login', event: (req?: any, res?: any) => Users.login(req, res) },
  { isAuth: false, type: 'post', path: 'register', event: (req?: any, res?: any) => Users.add(req, res) },
  { type: 'post', path: 'user/add', event: (req?: any, res?: any) => Users.add(req, res) },
  { type: 'delete', path: 'user/del', event: (req?: any, res?: any) => Users.del(req, res) },
  { type: 'put', path: 'user/edit', event: (req?: any, res?: any) => Users.edit(req, res) },
  { type: 'get', path: 'user/list', event: (req?: any, res?: any) => Users.list(req, res) },
  { type: 'get', path: 'user/groupList', event: (req?: any, res?: any) => Users.groupList(req, res) },


  // 权限组
  { type: 'post', path: 'roleGroup/add', event: (req?: any, res?: any) => RoleGroups.add(req, res) },
  { type: 'put', path: 'roleGroup/edit', event: (req?: any, res?: any) => RoleGroups.edit(req, res) },
  { type: 'delete', path: 'roleGroup/del', event: (req?: any, res?: any) => RoleGroups.del(req, res) },
  { type: 'get', path: 'roleGroup/list', event: (req?: any, res?: any) => RoleGroups.list(req, res) },


  // 权限
  { type: 'post', path: 'role/add', event: (req?: any, res?: any) => Roles.add(req, res) },
  { type: 'put', path: 'role/edit', event: (req?: any, res?: any) => Roles.edit(req, res) },
  { type: 'delete', path: 'role/del', event: (req?: any, res?: any) => Roles.del(req, res) },
  { type: 'get', path: 'role/list', event: (req?: any, res?: any) => Roles.list(req, res) },
  { type: 'get', path: 'role/tree', event: (req?: any, res?: any) => Roles.tree(req, res) },

  // 数据备份
  { type: 'get', path: 'backups/tablelist', event: (req: any, res: any) => Backupss.tablelist(req, res) },
  { type: 'post', path: 'backups/add', event: (req: any, res: any) => Backupss.add(req, res) },
  { type: 'delete', path: 'backups/del', event: (req: any, res: any) => Backupss.del(req, res) },
  { type: 'put', path: 'backups/edit', event: (req: any, res: any) => Backupss.edit(req, res) },
  { type: 'get', path: 'backups/list', event: (req: any, res: any) => Backupss.list(req, res) },
  { type: 'post', path: 'backups/reset', event: (req: any, res: any) => Backupss.reset(req, res) },
  { type: 'get', path: 'backups/tablelist', event: (req: any, res: any) => Backupss.tablelist(req, res) },
  { type: 'post', path: 'backups/addOne', event: (req: any, res: any) => Backupss.addOne(req, res) },
  { type: 'post', path: 'backups/resetOne', event: (req: any, res: any) => Backupss.resetOne(req, res) },
]